<?php defined( 'BASEPATH' ) or die( 'Restricted' );

/*
This code is copyright 2009-2010 by TMLA INC.  ALL RIGHTS RESERVED.
Please view license.txt in /tgsf_core/legal/license.txt or
http://tgWebSolutions.com/opensource/tgsf/license.txt
for complete licensing information.
*/

if ( GET()->isEmpty( 'ag' ) )
{
	URL( '' )->redirect();
}

$tag = trim( urldecode( GET()->ag ) );


$metaDescription = 'ProgChat.com link stream for ' . $tag;
$windowTitle = 'ProgChat.com - Interesting  ' . $tag . ' and software development and information technology links';
$pageTitle =  'links about ' . $tag;
//------------------------------------------------------------------------

$linksModel = load_model( 'links' );
$linkTagModel = load_model( 'link_tag' );

$tag_id = load_model( 'tag' )->fetch_id( $tag );

$query = $linksModel->getFetchQuery( )
->where( 'link_id in ( select link_tag_link_id from link_tag where link_tag_tag_id = :tag_id ) ' )
->bindValue( 'tag_id', $tag_id, ptINT );

$prev = $query->getPrevLinkUrl( 't' )->setVar( 'ag', $tag );
$next = $query->getNextLinkUrl( 't' )->setVar( 'ag', $tag );

$rows = $query->exec()->fetchAll();

//------------------------------------------------------------------------
include view( 'header' );
include view( 'template/top' );
include view( 't' );
include view( 'footer' );


//include controller( 'home' );